import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:safe_manage/config/my_app_routes.dart';
import 'my_splash_controller.dart';

class MySplashPage extends StatelessWidget {
  final controller = Get.find<MySplashController>();
  MySplashPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      child: Column(
        children: [
          Expanded(flex: 2, child: Container()),
          Image.asset(
            "images/splash_logo.png",
            width: 200,
            height: 80,
          ),
          const SizedBox(height: 12),
          const Text(
            "安全生产管理系统",
            style: TextStyle(
              color: Color(0xFF333333),
              fontWeight: FontWeight.bold,
              fontSize: 20,
            ),
          ),
          const SizedBox(height: 18),
          const Text(
            "一站式安全事件管理智能平台",
            style: TextStyle(
              color: Color(0xFF333333),
              fontSize: 16,
            ),
          ),
          Expanded(flex: 4, child: Container()),
          Obx(
            () => Visibility(
              visible: controller.showLoginButton.value,
              child: Container(
                width: Get.width,
                height: 40,
                padding: const EdgeInsets.fromLTRB(60, 0, 60, 0),
                child: ElevatedButton(
                  onPressed: () {
                    Get.toNamed(MyAppRoutes.myLogin);
                  },
                  style: ButtonStyle(
                    padding: MaterialStateProperty.all(EdgeInsets.zero),
                    backgroundColor: MaterialStateProperty.all(
                      const Color(0xFF0055A4),
                    ),
                    shape: MaterialStateProperty.all(
                      RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(5),
                      ),
                    ), //圆角弧度
                  ),
                  child: const Text(
                    "登录",
                    style: TextStyle(
                      fontSize: 14,
                    ),
                  ),
                ),
              ),
            ),
          ),
          Expanded(flex: 1, child: Container()),
        ],
      ),
    );
  }
}
